package graduate.wangyaqi.ErrorCorrectionQuestions;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Optional;

@RestController
@CrossOrigin(origins = "*", maxAge = 3600)
@RequestMapping(path="/ErrorCorrectionQuestions")
public class ErrorCorrectionQuestionsController {
    @Autowired
    private ErrorCorrectionQuestionsService errorCorrectionQuestionsService;

    @GetMapping(path="/getAllByTaotiID")
    public Iterable<ErrorCorrectionQuestions> getAllByTaotiID(long id){
        Iterable<ErrorCorrectionQuestions> list= errorCorrectionQuestionsService.getAllByTaotiID(id);
        return list;
    }

    @GetMapping(path="/findById")
    public Optional<ErrorCorrectionQuestions> findById(Long aLong){
        return errorCorrectionQuestionsService.findById(aLong);
    }
}
